package com.aeoj.clientmanagement.domain.problem;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 题目表
 * @TableName aeoj_problem
 */
@TableName(value ="aeoj_problem")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class Problem {
    /**
     * 题目ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 题目标题
     */
    private String title;

    /**
     * 题目内容，MarkDown格式
     */
    private String content;

    /**
     * 题目输入用例，存储JSON格式字符串
     */
    private String inputCases;

    /**
     * 题目输出用例，存储JSON格式字符串
     */
    private String outputCases;

    /**
     * 题目标签，逗号分隔的字符串
     */
    private String tags;

    /**
     * 题目难度：0简单，1中等，2困难
     */
    private Integer difficulty;

    /**
     * 题目提示，每行一个提示
     */
    private String hints;

    /**
     * 时间限制(ms)
     */
    private Integer timeLimit;

    /**
     * 内存限制(MB)
     */
    private Integer memoryLimit;

    /**
     * 总提交次数
     */
    private Integer submissionCount;

    /**
     * 总通过次数
     */
    private Integer acceptedCount;

    /**
     * 总点赞次数
     */
    private Integer likes;

    /**
     * 总收藏次数
     */
    private Integer favorites;

    /**
     * 创建者用户ID
     */
    private Long createBy;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改者用户ID
     */
    private Long updateBy;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 删除标记：0未删除，1已删除
     */
    private Integer deleted;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Problem other = (Problem) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
            && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
            && (this.getInputCases() == null ? other.getInputCases() == null : this.getInputCases().equals(other.getInputCases()))
            && (this.getOutputCases() == null ? other.getOutputCases() == null : this.getOutputCases().equals(other.getOutputCases()))
            && (this.getTags() == null ? other.getTags() == null : this.getTags().equals(other.getTags()))
            && (this.getDifficulty() == null ? other.getDifficulty() == null : this.getDifficulty().equals(other.getDifficulty()))
            && (this.getHints() == null ? other.getHints() == null : this.getHints().equals(other.getHints()))
            && (this.getTimeLimit() == null ? other.getTimeLimit() == null : this.getTimeLimit().equals(other.getTimeLimit()))
            && (this.getMemoryLimit() == null ? other.getMemoryLimit() == null : this.getMemoryLimit().equals(other.getMemoryLimit()))
            && (this.getSubmissionCount() == null ? other.getSubmissionCount() == null : this.getSubmissionCount().equals(other.getSubmissionCount()))
            && (this.getAcceptedCount() == null ? other.getAcceptedCount() == null : this.getAcceptedCount().equals(other.getAcceptedCount()))
            && (this.getLikes() == null ? other.getLikes() == null : this.getLikes().equals(other.getLikes()))
            && (this.getFavorites() == null ? other.getFavorites() == null : this.getFavorites().equals(other.getFavorites()))
            && (this.getCreateBy() == null ? other.getCreateBy() == null : this.getCreateBy().equals(other.getCreateBy()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateBy() == null ? other.getUpdateBy() == null : this.getUpdateBy().equals(other.getUpdateBy()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
        result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
        result = prime * result + ((getInputCases() == null) ? 0 : getInputCases().hashCode());
        result = prime * result + ((getOutputCases() == null) ? 0 : getOutputCases().hashCode());
        result = prime * result + ((getTags() == null) ? 0 : getTags().hashCode());
        result = prime * result + ((getDifficulty() == null) ? 0 : getDifficulty().hashCode());
        result = prime * result + ((getHints() == null) ? 0 : getHints().hashCode());
        result = prime * result + ((getTimeLimit() == null) ? 0 : getTimeLimit().hashCode());
        result = prime * result + ((getMemoryLimit() == null) ? 0 : getMemoryLimit().hashCode());
        result = prime * result + ((getSubmissionCount() == null) ? 0 : getSubmissionCount().hashCode());
        result = prime * result + ((getAcceptedCount() == null) ? 0 : getAcceptedCount().hashCode());
        result = prime * result + ((getLikes() == null) ? 0 : getLikes().hashCode());
        result = prime * result + ((getFavorites() == null) ? 0 : getFavorites().hashCode());
        result = prime * result + ((getCreateBy() == null) ? 0 : getCreateBy().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateBy() == null) ? 0 : getUpdateBy().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", title=").append(title);
        sb.append(", content=").append(content);
        sb.append(", inputCases=").append(inputCases);
        sb.append(", outputCases=").append(outputCases);
        sb.append(", tags=").append(tags);
        sb.append(", difficulty=").append(difficulty);
        sb.append(", hints=").append(hints);
        sb.append(", timeLimit=").append(timeLimit);
        sb.append(", memoryLimit=").append(memoryLimit);
        sb.append(", submissionCount=").append(submissionCount);
        sb.append(", acceptedCount=").append(acceptedCount);
        sb.append(", likes=").append(likes);
        sb.append(", favorites=").append(favorites);
        sb.append(", createBy=").append(createBy);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateBy=").append(updateBy);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", deleted=").append(deleted);
        sb.append("]");
        return sb.toString();
    }
}